package com.ruoyi.financial.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.financial.bo.FCodeBo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.financial.mapper.FCodeMapper;
import com.ruoyi.financial.domain.FCode;
import com.ruoyi.financial.service.IFCodeService;

/**
 * 码Service业务层处理
 *
 * @author ruoyi
 * @date 2025-02-06
 */
@Service
public class FCodeServiceImpl implements IFCodeService
{
    @Autowired
    private FCodeMapper fCodeMapper;

    /**
     * 查询码
     *
     * @param id 码主键
     * @return 码
     */
    @Override
    public FCode selectFCodeById(Long id)
    {
        return fCodeMapper.selectFCodeById(id);
    }

    /**
     * 查询码列表
     *
     * @param fCode 码
     * @return 码
     */
    @Override
    public List<FCode> selectFCodeList(FCodeBo fCode)
    {
        return fCodeMapper.selectFCodeList(fCode);
    }

    /**
     * 新增码
     *
     * @param fCode 码
     * @return 结果
     */
    @Override
    public int insertFCode(FCode fCode)
    {
        fCode.setCreateTime(DateUtils.getNowDate());
        return fCodeMapper.insertFCode(fCode);
    }

    /**
     * 修改码
     *
     * @param fCode 码
     * @return 结果
     */
    @Override
    public int updateFCode(FCode fCode)
    {
        fCode.setUpdateTime(DateUtils.getNowDate());
        return fCodeMapper.updateFCode(fCode);
    }

    /**
     * 批量删除码
     *
     * @param ids 需要删除的码主键
     * @return 结果
     */
    @Override
    public int deleteFCodeByIds(Long[] ids)
    {
        return fCodeMapper.deleteFCodeByIds(ids);
    }

    /**
     * 删除码信息
     *
     * @param id 码主键
     * @return 结果
     */
    @Override
    public int deleteFCodeById(Long id)
    {
        return fCodeMapper.deleteFCodeById(id);
    }

    @Override
    public void batchInsert(List<FCode> fCodeList) {
        fCodeMapper.batchInsert(fCodeList);
    }

    @Override
    public void deleteFCodeByYear(Integer year) {
        fCodeMapper.deleteFCodeByYear(year);
    }
}
